How to Change the RDP Port for Your Windows Server

The default Remote Desktop Protocol (RDP) port for Windows servers is 3389. You can strengthen the server security by modifying the RDP port to prevent brute force attacks. This article will show you how to change the RDP port for your Windows Server.

1. Log in to your Windows Server

To log in to your remote Windows server, please refer to How to connect to a Windows Remote Server.

2. Steps to change RDP Port

Here, we will introduct how to mannually modify the port and how to change the port using powershell command.

Using Powershell command

  1. Type PowerShell in the Search box to open Windows PowerShell.

Open powershell

  1. Modify port

In this example, we use 3389 as the new port. Be sure to replace it with a custom port you'd like to use. Run the following command:

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -Name 'portnumber' -Value 3389

Change port

  1. Open the new RDP port in Windows Firewall
New-NetFirewallRule -displayname 'RDP(3389)' -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow

Open ports in Windows Firewall

  1. Restart RDP service
get-service TermService | restart-service -force

Restart RDP service

Manually Modify port

  1. Change the RDP port by modifying the registry manually

Press “Windows + R” to open Windows Run dialog. Type “regedit” in the Run box and press Enter to open Windows Registry Editor.

Open registry

Navigate to the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber

Click Edit > Modify, and then click Decimal. Type the new port number, and then click OK. The recommended range for RDP ports is 1024-65535.

Change port in Registry

  1. Open the new RDP port in Windows Firewall

Please refer to Youtube tutorial How to Open a Port in Windows Firewall.

  1. Restart the RDP service

Type services in the Search box. Open Services.

Open services

Restart Remote Desktop Services

Restart RDP service

3. Test

Test the connection to the server with the new RDP port.

You need to fill in "IP:port” in the Computer column. For example: 10.10.XX.XX:3389

Input IP and port

Copyright © 2022 Cloud Clusters Inc.Revised on 07/21/2024

results matching ""

    No results matching ""